//! Provides erlang's NIF convenience functions to your Zig code.
//!
//! This struct derives from `zig/beam/erl_nif.zig`.  Usually brought in as
//! `const e = @import("erl_nif").c;`, leading to the aliased shortcut `e`.
//!
//! for example, to call the enif_alloc function, you would use the following
//! code:
//!
//! ```
//! const e = @import("erl_nif").c;
//!
//! pub fn give_me_ten_bytes() ?*u8 {
//!   return e.enif_alloc(10);
//! }
//! ```
//!
//! refer to the [erlang documentation](https://erlang.org/doc/man/erl_nif.html)
//! for available functions

// note: currently, zig is incapable of substituting a macro variable for a
// C struct field.  Until that is fixed
const builtin = @import("builtin");

const e = if (builtin.os.tag == .windows) @cImport(@cInclude("erl_nif_win.h")) else @cImport(@cInclude("erl_nif.h"));

pub const ErlNifTerm = e.ERL_NIF_TERM;

pub const is_sema = false;

pub const ERL_NIF_MAJOR_VERSION = e.ERL_NIF_MAJOR_VERSION;
pub const ERL_NIF_MINOR_VERSION = e.ERL_NIF_MINOR_VERSION;
pub const ERL_NIF_MIN_ERTS_VERSION = e.ERL_NIF_MIN_ERTS_VERSION;
pub const ERL_NIF_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD = e.ERL_NIF_MIN_REQUIRED_MAJOR_VERSION_ON_LOAD;
pub const ERL_NIF_VM_VARIANT = e.ERL_NIF_VM_VARIANT;
pub const ERL_NIF_TIME_ERROR = e.ERL_NIF_TIME_ERROR;
pub const ERL_NIF_SELECT_STOP_CALLED = e.ERL_NIF_SELECT_STOP_CALLED;
pub const ERL_NIF_SELECT_STOP_SCHEDULED = e.ERL_NIF_SELECT_STOP_SCHEDULED;
pub const ERL_NIF_SELECT_INVALID_EVENT = e.ERL_NIF_SELECT_INVALID_EVENT;
pub const ERL_NIF_SELECT_FAILED = e.ERL_NIF_SELECT_FAILED;
pub const ERL_NIF_SELECT_READ_CANCELLED = e.ERL_NIF_SELECT_READ_CANCELLED;
pub const ERL_NIF_SELECT_WRITE_CANCELLED = e.ERL_NIF_SELECT_WRITE_CANCELLED;
pub const ERL_NIF_SELECT_ERROR_CANCELLED = e.ERL_NIF_SELECT_ERROR_CANCELLED;
pub const ERL_NIF_SELECT_NOTSUP = e.ERL_NIF_SELECT_NOTSUP;
pub const ERL_NIF_IOVEC_SIZE = e.ERL_NIF_IOVEC_SIZE;
pub const ERL_NIF_THR_UNDEFINED = e.ERL_NIF_THR_UNDEFINED;
pub const ERL_NIF_THR_NORMAL_SCHEDULER = e.ERL_NIF_THR_NORMAL_SCHEDULER;
pub const ERL_NIF_THR_DIRTY_CPU_SCHEDULER = e.ERL_NIF_THR_DIRTY_CPU_SCHEDULER;
pub const ERL_NIF_THR_DIRTY_IO_SCHEDULER = e.ERL_NIF_THR_DIRTY_IO_SCHEDULER;
pub const ERL_NIF_API_FUNC_DECL = e.ERL_NIF_API_FUNC_DECL;
pub const ERL_NIF_API_FUNC_MACRO = e.ERL_NIF_API_FUNC_MACRO;
pub const ERL_NIF_INIT_GLOB = e.ERL_NIF_INIT_GLOB;
pub const ERL_NIF_INIT_ARGS = e.ERL_NIF_INIT_ARGS;
pub const ERL_NIF_INIT_BODY = e.ERL_NIF_INIT_BODY;
pub const ERL_NIF_INIT_EXPORT = e.ERL_NIF_INIT_EXPORT;
pub const ERL_NIF_INIT_NAME = e.ERL_NIF_INIT_NAME;
pub const ERL_NIF_INIT_NAME2 = e.ERL_NIF_INIT_NAME2;
pub const ERL_NIF_INIT_NAME3 = e.ERL_NIF_INIT_NAME3;
pub const ERL_NIF_INIT_DECL = e.ERL_NIF_INIT_DECL;
pub const ERL_NIF_INIT_PROLOGUE = e.ERL_NIF_INIT_PROLOGUE;
pub const ERL_NIF_INIT_EPILOGUE = e.ERL_NIF_INIT_EPILOGUE;
pub const ERL_NIF_INIT = e.ERL_NIF_INIT;
pub const HAVE_USE_DTRACE = e.HAVE_USE_DTRACE;
pub const STATIC_ERLANG_NIF = e.STATIC_ERLANG_NIF;
pub const ErlNifUInt64 = e.ErlNifUInt64;
pub const ErlNifSInt64 = e.ErlNifSInt64;
pub const ErlNifUInt = e.ErlNifUInt;
pub const ErlNifSInt = e.ErlNifSInt;
pub const ERL_NIF_TERM = e.ERL_NIF_TERM;
pub const ERL_NIF_UINT = e.ERL_NIF_UINT;
pub const ErlNifTime = e.ErlNifTime;
pub const ErlNifEnv = e.ErlNifEnv;
pub const ErlNifFunc = e.ErlNifFunc;
pub const ErlNifEntry = e.ErlNifEntry;
pub const ErlNifBinary = e.ErlNifBinary;
pub const ErlNifEvent = e.ErlNifEvent;
pub const ErlNifPid = e.ErlNifPid;
pub const ErlNifPort = e.ErlNifPort;
pub const ErlNifMonitor = e.ErlNifMonitor;
pub const ErlNifOnHaltCallback = e.ErlNifOnHaltCallback;
pub const ErlNifOnUnloadThreadCallback = e.ErlNifOnUnloadThreadCallback;
pub const ErlNifResourceType = e.ErlNifResourceType;
pub const ErlNifResourceDtor = e.ErlNifResourceDtor;
pub const ErlNifResourceStop = e.ErlNifResourceStop;
pub const ErlNifResourceDown = e.ErlNifResourceDown;
pub const ErlNifResourceDynCall = e.ErlNifResourceDynCall;
pub const ErlNifResourceTypeInit = e.ErlNifResourceTypeInit;
pub const ErlNifSysInfo = e.ErlNifSysInfo;
pub const ErlNifTid = e.ErlNifTid;
pub const ErlNifMutex = e.ErlNifMutex;
pub const ErlNifCond = e.ErlNifCond;
pub const ErlNifRWLock = e.ErlNifRWLock;
pub const ErlNifTSDKey = e.ErlNifTSDKey;
pub const ErlNifThreadOpts = e.ErlNifThreadOpts;
pub const ErlNifMapIterator = e.ErlNifMapIterator;
pub const TWinDynNifCallbacks = e.TWinDynNifCallbacks;
pub const ErlNifTimeUnit = e.ErlNifTimeUnit;
pub const ERL_NIF_SEC = e.ERL_NIF_SEC;
pub const ERL_NIF_MSEC = e.ERL_NIF_MSEC;
pub const ERL_NIF_USEC = e.ERL_NIF_USEC;
pub const ERL_NIF_NSEC = e.ERL_NIF_NSEC;
pub const ErlNifResourceFlags = e.ErlNifResourceFlags;
pub const ERL_NIF_RT_CREATE = e.ERL_NIF_RT_CREATE;
pub const ERL_NIF_RT_TAKEOVER = e.ERL_NIF_RT_TAKEOVER;
pub const ErlNifCharEncoding = e.ErlNifCharEncoding;
pub const ERL_NIF_LATIN1 = e.ERL_NIF_LATIN1;
pub const ERL_NIF_UTF8 = e.ERL_NIF_UTF8;
pub const ErlNifDirtyTaskFlags = e.ErlNifDirtyTaskFlags;
pub const ERL_NIF_DIRTY_JOB_CPU_BOUND = e.ERL_NIF_DIRTY_JOB_CPU_BOUND;
pub const ERL_NIF_DIRTY_JOB_IO_BOUND = e.ERL_NIF_DIRTY_JOB_IO_BOUND;
pub const ErlNifMapIteratorEntry = e.ErlNifMapIteratorEntry;
pub const ERL_NIF_MAP_ITERATOR_FIRST = e.ERL_NIF_MAP_ITERATOR_FIRST;
pub const ERL_NIF_MAP_ITERATOR_LAST = e.ERL_NIF_MAP_ITERATOR_LAST;
pub const ERL_NIF_MAP_ITERATOR_HEAD = e.ERL_NIF_MAP_ITERATOR_HEAD;
pub const ERL_NIF_MAP_ITERATOR_TAIL = e.ERL_NIF_MAP_ITERATOR_TAIL;
pub const ErlNifUniqueInteger = e.ErlNifUniqueInteger;
pub const ERL_NIF_UNIQUE_POSITIVE = e.ERL_NIF_UNIQUE_POSITIVE;
pub const ERL_NIF_UNIQUE_MONOTONIC = e.ERL_NIF_UNIQUE_MONOTONIC;
pub const ErlNifBinaryToTerm = e.ErlNifBinaryToTerm;
pub const ERL_NIF_BIN2TERM_SAFE = e.ERL_NIF_BIN2TERM_SAFE;
pub const ErlNifHash = e.ErlNifHash;
pub const ERL_NIF_INTERNAL_HASH = e.ERL_NIF_INTERNAL_HASH;
pub const ERL_NIF_PHASH2 = e.ERL_NIF_PHASH2;
pub const ErlNifIOVec = e.ErlNifIOVec;
pub const ErlNifIOQueue = e.ErlNifIOQueue;
pub const ErlNifIOQueueOpts = e.ErlNifIOQueueOpts;
pub const ERL_NIF_IOQ_NORMAL = e.ERL_NIF_IOQ_NORMAL;
pub const ErlNifTermType = e.ErlNifTermType;
pub const ERL_NIF_TERM_TYPE_ATOM = e.ERL_NIF_TERM_TYPE_ATOM;
pub const ERL_NIF_TERM_TYPE_BITSTRING = e.ERL_NIF_TERM_TYPE_BITSTRING;
pub const ERL_NIF_TERM_TYPE_FLOAT = e.ERL_NIF_TERM_TYPE_FLOAT;
pub const ERL_NIF_TERM_TYPE_FUN = e.ERL_NIF_TERM_TYPE_FUN;
pub const ERL_NIF_TERM_TYPE_INTEGER = e.ERL_NIF_TERM_TYPE_INTEGER;
pub const ERL_NIF_TERM_TYPE_LIST = e.ERL_NIF_TERM_TYPE_LIST;
pub const ERL_NIF_TERM_TYPE_MAP = e.ERL_NIF_TERM_TYPE_MAP;
pub const ERL_NIF_TERM_TYPE_PID = e.ERL_NIF_TERM_TYPE_PID;
pub const ERL_NIF_TERM_TYPE_PORT = e.ERL_NIF_TERM_TYPE_PORT;
pub const ERL_NIF_TERM_TYPE_REFERENCE = e.ERL_NIF_TERM_TYPE_REFERENCE;
pub const ERL_NIF_TERM_TYPE_TUPLE = e.ERL_NIF_TERM_TYPE_TUPLE;
pub const ERL_NIF_TERM_TYPE__MISSING_DEFAULT_CASE__READ_THE_MANUAL = e.ERL_NIF_TERM_TYPE__MISSING_DEFAULT_CASE__READ_THE_MANUAL;
pub const ErlNifOption = e.ErlNifOption;
pub const ERL_NIF_OPT_DELAY_HALT = e.ERL_NIF_OPT_DELAY_HALT;
pub const ERL_NIF_OPT_ON_HALT = e.ERL_NIF_OPT_ON_HALT;
pub const ERL_NIF_OPT_ON_UNLOAD_THREAD = e.ERL_NIF_OPT_ON_UNLOAD_THREAD;
pub const enif_free = e.enif_free;
pub const enif_alloc = e.enif_alloc;
pub const enif_mutex_destroy = e.enif_mutex_destroy;
pub const enif_cond_destroy = e.enif_cond_destroy;
pub const enif_rwlock_destroy = e.enif_rwlock_destroy;
pub const enif_thread_opts_destroy = e.enif_thread_opts_destroy;
pub const enif_ioq_destroy = e.enif_ioq_destroy;
pub const erl_nif_user_trace_s1 = e.erl_nif_user_trace_s1;
pub const erl_nif_user_trace_i4s4 = e.erl_nif_user_trace_i4s4;
pub const erl_nif_user_trace_n = e.erl_nif_user_trace_n;
pub const enif_alloc_env = e.enif_alloc_env;
pub const enif_free_env = e.enif_free_env;
pub const enif_clear_env = e.enif_clear_env;
pub const enif_make_copy = e.enif_make_copy;
pub const enif_is_process_alive = e.enif_is_process_alive;
pub const enif_send = e.enif_send;
pub const enif_self = e.enif_self;
pub const enif_priv_data = e.enif_priv_data;
pub const enif_system_info = e.enif_system_info;
pub const enif_make_badarg = e.enif_make_badarg;
pub const enif_raise_exception = e.enif_raise_exception;
pub const enif_has_pending_exception = e.enif_has_pending_exception;
pub const enif_is_exception = e.enif_is_exception;
pub const enif_make_atom = e.enif_make_atom;
pub const enif_make_atom_len = e.enif_make_atom_len;
pub const enif_make_existing_atom = e.enif_make_existing_atom;
pub const enif_make_existing_atom_len = e.enif_make_existing_atom_len;
pub const enif_make_new_atom = e.enif_make_new_atom;
pub const enif_make_new_atom_len = e.enif_make_new_atom_len;
pub const enif_is_atom = e.enif_is_atom;
pub const enif_make_int = e.enif_make_int;
pub const enif_make_long = e.enif_make_long;
pub const enif_make_int64 = e.enif_make_int64;
pub const enif_make_uint = e.enif_make_uint;
pub const enif_make_ulong = e.enif_make_ulong;
pub const enif_make_uint64 = e.enif_make_uint64;
pub const enif_make_double = e.enif_make_double;
pub const enif_get_atom = e.enif_get_atom;
pub const enif_is_current_process_alive = e.enif_is_current_process_alive;
pub const enif_realloc = e.enif_realloc;
pub const enif_get_int = e.enif_get_int;
pub const enif_get_long = e.enif_get_long;
pub const enif_get_int64 = e.enif_get_int64;
pub const enif_get_uint = e.enif_get_uint;
pub const enif_get_ulong = e.enif_get_ulong;
pub const enif_get_uint64 = e.enif_get_uint64;
pub const enif_get_double = e.enif_get_double;
pub const enif_make_unique_integer = e.enif_make_unique_integer;
pub const enif_make_string = e.enif_make_string;
pub const enif_make_string_len = e.enif_make_string_len;
pub const enif_get_string = e.enif_get_string;
pub const enif_get_string_length = e.enif_get_string_length;
pub const enif_term_to_binary = e.enif_term_to_binary;
pub const enif_binary_to_term = e.enif_binary_to_term;
pub const enif_alloc_binary = e.enif_alloc_binary;
pub const enif_realloc_binary = e.enif_realloc_binary;
pub const enif_release_binary = e.enif_release_binary;
pub const enif_inspect_binary = e.enif_inspect_binary;
pub const enif_inspect_iolist_as_binary = e.enif_inspect_iolist_as_binary;
pub const enif_make_binary = e.enif_make_binary;
pub const enif_make_sub_binary = e.enif_make_sub_binary;
pub const enif_make_new_binary = e.enif_make_new_binary;
pub const enif_make_tuple = e.enif_make_tuple;
pub const enif_make_tuple_from_array = e.enif_make_tuple_from_array;
pub const enif_get_tuple = e.enif_get_tuple;
pub const enif_make_tuple1 = e.enif_make_tuple1;
pub const enif_make_tuple2 = e.enif_make_tuple2;
pub const enif_make_tuple3 = e.enif_make_tuple3;
pub const enif_make_list = e.enif_make_list;
pub const enif_make_list_from_array = e.enif_make_list_from_array;
pub const enif_make_list_cell = e.enif_make_list_cell;
pub const enif_get_list_cell = e.enif_get_list_cell;
pub const enif_get_list_length = e.enif_get_list_length;
pub const enif_make_reverse_list = e.enif_make_reverse_list;
pub const enif_is_empty_list = e.enif_is_empty_list;
pub const enif_make_new_map = e.enif_make_new_map;
pub const enif_make_map_put = e.enif_make_map_put;
pub const enif_make_map_update = e.enif_make_map_update;
pub const enif_make_map_remove = e.enif_make_map_remove;
pub const enif_get_map_value = e.enif_get_map_value;
pub const enif_get_map_size = e.enif_get_map_size;
pub const enif_map_iterator_create = e.enif_map_iterator_create;
pub const enif_map_iterator_destroy = e.enif_map_iterator_destroy;
pub const enif_map_iterator_is_head = e.enif_map_iterator_is_head;
pub const enif_map_iterator_is_tail = e.enif_map_iterator_is_tail;
pub const enif_map_iterator_next = e.enif_map_iterator_next;
pub const enif_map_iterator_prev = e.enif_map_iterator_prev;
pub const enif_map_iterator_get_pair = e.enif_map_iterator_get_pair;
pub const enif_make_map_from_arrays = e.enif_make_map_from_arrays;
pub const enif_is_identical = e.enif_is_identical;
pub const enif_compare = e.enif_compare;
pub const enif_is_number = e.enif_is_number;
pub const enif_is_pid = e.enif_is_pid;
pub const enif_is_port = e.enif_is_port;
pub const enif_is_ref = e.enif_is_ref;
pub const enif_is_binary = e.enif_is_binary;
pub const enif_is_fun = e.enif_is_fun;
pub const enif_is_tuple = e.enif_is_tuple;
pub const enif_is_map = e.enif_is_map;
pub const enif_term_type = e.enif_term_type;
pub const enif_get_local_pid = e.enif_get_local_pid;
pub const enif_get_local_port = e.enif_get_local_port;
pub const enif_make_pid = e.enif_make_pid;
pub const enif_make_ref = e.enif_make_ref;
pub const enif_open_resource_type = e.enif_open_resource_type;
pub const enif_open_resource_type_x = e.enif_open_resource_type_x;
pub const enif_init_resource_type = e.enif_init_resource_type;
pub const enif_alloc_resource = e.enif_alloc_resource;
pub const enif_release_resource = e.enif_release_resource;
pub const enif_keep_resource = e.enif_keep_resource;
pub const enif_make_resource = e.enif_make_resource;
pub const enif_get_resource = e.enif_get_resource;
pub const enif_dynamic_resource_call = e.enif_dynamic_resource_call;
pub const enif_monitor_process = e.enif_monitor_process;
pub const enif_demonitor_process = e.enif_demonitor_process;
pub const enif_compare_monitors = e.enif_compare_monitors;
pub const enif_make_resource_binary = e.enif_make_resource_binary;
pub const enif_inspect_iovec = e.enif_inspect_iovec;
pub const enif_free_iovec = e.enif_free_iovec;
pub const enif_ioq_create = e.enif_ioq_create;
pub const enif_ioq_enq_binary = e.enif_ioq_enq_binary;
pub const enif_ioq_enqv = e.enif_ioq_enqv;
pub const enif_ioq_deq = e.enif_ioq_deq;
pub const enif_ioq_peek = e.enif_ioq_peek;
pub const enif_ioq_peek_head = e.enif_ioq_peek_head;
pub const enif_ioq_size = e.enif_ioq_size;
pub const enif_monotonic_time = e.enif_monotonic_time;
pub const enif_time_offset = e.enif_time_offset;
pub const enif_convert_time_unit = e.enif_convert_time_unit;
pub const enif_consume_timeslice = e.enif_consume_timeslice;
pub const enif_schedule_nif = e.enif_schedule_nif;
pub const enif_thread_type = e.enif_thread_type;
pub const enif_select = e.enif_select;
pub const enif_select_read = e.enif_select_read;
pub const enif_select_write = e.enif_select_write;
pub const enif_thread_create = e.enif_thread_create;
pub const enif_thread_join = e.enif_thread_join;
pub const enif_tid_equal = e.enif_tid_equal;
pub const enif_mutex_create = e.enif_mutex_create;
pub const enif_mutex_lock = e.enif_mutex_lock;
pub const enif_mutex_trylock = e.enif_mutex_trylock;
pub const enif_mutex_unlock = e.enif_mutex_unlock;
pub const enif_rwlock_create = e.enif_rwlock_create;
pub const enif_rwlock_rlock = e.enif_rwlock_rlock;
pub const enif_rwlock_runlock = e.enif_rwlock_runlock;
pub const enif_rwlock_rwlock = e.enif_rwlock_rwlock;
pub const enif_rwlock_rwunlock = e.enif_rwlock_rwunlock;
pub const enif_rwlock_tryrlock = e.enif_rwlock_tryrlock;
pub const enif_rwlock_tryrwlock = e.enif_rwlock_tryrwlock;
pub const enif_cond_create = e.enif_cond_create;
pub const enif_cond_signal = e.enif_cond_signal;
pub const enif_cond_broadcast = e.enif_cond_broadcast;
pub const enif_cond_wait = e.enif_cond_wait;
pub const enif_tsd_key_create = e.enif_tsd_key_create;
pub const enif_tsd_key_delete = e.enif_tsd_key_delete;
pub const enif_tsd_set = e.enif_tsd_set;
pub const enif_tsd_get = e.enif_tsd_get;
pub const enif_thread_opts_create = e.enif_thread_opts_create;
pub const enif_hash = e.enif_hash;
pub const enif_phash2 = e.enif_phash2;
pub const enif_snprintf = e.enif_snprintf;
pub const enif_vsnprintf = e.enif_vsnprintf;
pub const enif_vfprintf = e.enif_vfprintf;
pub const enif_set_option = e.enif_set_option;
pub const enif_getenv = e.enif_getenv;